package com.snowflake.ecatalog.entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.google.common.collect.Lists;
import com.snowflake.ecatalog.contant.Status;

/**
 * 公司信息：包括启动图片、背景图片、公司简介、公司图片、联系信息
 */
// JPA标识
@Entity
@Table(name = "t_ec_companylaunch")
public class CompanyLaunch extends OpEntity {

	private Profile profile;
	private String name;
	private int type;
	private String remark;
	private int status;
	private List<ResourceInfo> resourceInfos;

	public CompanyLaunch() {
		super();
		resourceInfos = Lists.newArrayList();
	}

	// 不持久化到数据库
	@Transient
	public List<ResourceInfo> getResourceInfos() {
		return resourceInfos;
	}

	public void setResourceInfos(List<ResourceInfo> resourceInfos) {
		this.resourceInfos = resourceInfos;
	}

	// JPA 基于profile_id列的多对一关系定义
	@ManyToOne
	@JoinColumn(name = "profile_id")
	public Profile getProfile() {
		return profile;
	}

	public void setProfile(Profile profile) {
		this.profile = profile;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	// 不持久化到数据库
	@Transient
	public String getStatusName() {
		return Status.alias(this.status);
	}
}
